package edu.sysu.cshare.model;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "T_CLASS")
public class Clazz {

	private List<Course> courses;

	private long id;

	private String name;
	private List<User> students;

	public Clazz() {

	}

	public Clazz(String name) {
		super();
		this.name = name;
	}

	/*
	 * public void addCourse(Course course) { this.courses.add(course); }
	 * 
	 * public void addStudent(User student) { this.students.add(student); }
	 * 
	 * public void deleteCourse(Course course) { this.courses.remove(course); }
	 * 
	 * public void deleteStudent(User student) { this.students.remove(student);
	 * }
	 */

	@ManyToMany(mappedBy = "classes")
	public List<Course> getCourses() {
		return courses;
	}

	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	@OneToMany(mappedBy = "clazz")
	public List<User> getStudents() {
		return students;
	}

	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}

	public void setId(long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setStudents(List<User> students) {
		this.students = students;
	}

}
